/*     */ package com.zimbra.cs.account;
/*     */ 
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.util.Log;
/*     */ import com.zimbra.common.util.ZimbraLog;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class Server
/*     */   extends ZAttrServer
/*     */ {
/*     */   public Server(String name, String id, Map<String, Object> attrs, Map<String, Object> defaults, Provisioning prov)
/*     */   {
/*  38 */     super(name, id, attrs, defaults, prov);
/*     */     try {
/*  40 */       AlwaysOnCluster aoc = prov.getAlwaysOnCluster(this);
/*  41 */       if (aoc != null) {
/*  42 */         setOverrideDefaults(aoc.getServerOverrides());
/*     */       }
/*     */     } catch (ServiceException se) {
/*  45 */       ZimbraLog.account.warn("failed to get initialize server entry", se);
/*     */     }
/*     */   }
/*     */   
/*     */   public Entry.EntryType getEntryType()
/*     */   {
/*  51 */     return Entry.EntryType.SERVER;
/*     */   }
/*     */   
/*     */   public void deleteServer(String zimbraId) throws ServiceException {
/*  55 */     getProvisioning().deleteServer(getId());
/*     */   }
/*     */   
/*     */   public void modify(Map<String, Object> attrs) throws ServiceException {
/*  59 */     getProvisioning().modifyAttrs(this, attrs);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public boolean mailTransportMatches(String mailTransport)
/*     */   {
/*  68 */     if (mailTransport == null) {
/*  69 */       return true;
/*     */     }
/*  71 */     String serviceName = getAttr("zimbraServiceHostname", null);
/*     */     
/*  73 */     String[] parts = mailTransport.split(":");
/*  74 */     if ((serviceName != null) && (parts.length == 3) && 
/*  75 */       (parts[0].equalsIgnoreCase("lmtp")) && (parts[1].equals(serviceName))) {
/*  76 */       return true;
/*     */     }
/*     */     
/*  79 */     return false;
/*     */   }
/*     */   
/*     */   public boolean hasMailboxService() {
/*  83 */     return getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*     */   }
/*     */   
/*     */   public boolean hasProxyService() {
/*  87 */     return getMultiAttrSet("zimbraServiceEnabled").contains("proxy");
/*     */   }
/*     */   
/*     */   public boolean hasWebClientService()
/*     */   {
/*  92 */     String version = getAttr("zimbraServerVersion", null);
/*  93 */     if (version != null) {
/*  94 */       return getMultiAttrSet("zimbraServiceEnabled").contains("zimbra");
/*     */     }
/*  96 */     return getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*     */   }
/*     */   
/*     */ 
/*     */   public boolean hasAdminClientService()
/*     */   {
/* 102 */     String version = getAttr("zimbraServerVersion", null);
/* 103 */     if (version != null) {
/* 104 */       return getMultiAttrSet("zimbraServiceEnabled").contains("zimbraAdmin");
/*     */     }
/* 106 */     return getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*     */   }
/*     */   
/*     */ 
/*     */   public boolean hasMailClientService()
/*     */   {
/* 112 */     String version = getAttr("zimbraServerVersion", null);
/* 113 */     if (version != null) {
/* 114 */       return getMultiAttrSet("zimbraServiceEnabled").contains("service");
/*     */     }
/* 116 */     return getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*     */   }
/*     */   
/*     */ 
/*     */   public boolean hasZimletService()
/*     */   {
/* 122 */     String version = getAttr("zimbraServerVersion", null);
/* 123 */     if (version != null) {
/* 124 */       return getMultiAttrSet("zimbraServiceEnabled").contains("zimlet");
/*     */     }
/* 126 */     return getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*     */   }
/*     */   
/*     */   public boolean isLocalServer() throws ServiceException
/*     */   {
/* 131 */     Server localServer = getProvisioning().getLocalServer();
/* 132 */     return (getId() != null) && (getId().equals(localServer.getId()));
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/Server.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */